/*
 * @Author: liu wang wang
 * @Date: 2020-07-13 15:44:57
 * @LastEditTime: 2020-07-17 16:09:58
 * @LastEditors: liu wang wang
 * @Description: 客服弹框
 * @FilePath: \st-sdk-js\src\components\Concat.ts
 */
import Common from '../utils/Common';
import store from '../utils/store';
class Concat extends Common {
    constructor() {
        super();
    }
    public init({ theme, text }: { theme: string, text:string}): HTMLElement {
        const concatContent: HTMLElement = this.createDiv();
        // 文字描述
        const textBox: HTMLElement = this.createDiv();
        const desc: HTMLElement = this.createP();
        desc.innerText = text;
        const concatInfo: HTMLElement = this.createP();
        const qqtips: HTMLElement = this.createSpan();
        qqtips.innerText = 'QQ号：';
        const qq: HTMLElement = this.createSpan();
        qq.innerText = '3007673969 ';
        this.setStyle(qq, `color:${theme}`);
        const onlinetime: HTMLElement = this.createSpan();
        onlinetime.innerText = ' 在线时间：工作日 9:30 - 18:00';
        concatInfo.appendChild(qqtips);
        concatInfo.appendChild(qq);
        concatInfo.appendChild(onlinetime);
        textBox.appendChild(desc);
        textBox.appendChild(concatInfo);
        this.setStyle(textBox, 'text-align:center;font-size:12px;line-height:20px;');
        // 二维码
        const code: HTMLImageElement = this.createImg();
        code.src = 'https://oss-cn-hangzhou.aliyuncs.com/image-storage/GameVersionCommercial/20207131534422086606146.png'
        code.width = 154;
        code.height = 154;
        this.setStyle(code, 'display:block;margin:13px auto;');
        // 企业二维码
        const codeTxt = this.createP();
        codeTxt.innerText = '企业QQ二维码';
        this.setStyle(codeTxt, 'font-size:12px;margin-bottom:23px;text-align:center;');
        // 完成按钮
        const sureBtn: HTMLElement = this.getButton({
            width: 88,
            height: 30,
            text: '知道了',
            background: theme,
            color: '#fff',
            clickHandle: () => {
                this.close();
                store.getStore('close') && store.getStore('close')();
            }
        });
        this.setStyle(sureBtn, 'margin:0 auto;display:block;');
        concatContent.appendChild(textBox);
        concatContent.appendChild(code);
        concatContent.appendChild(codeTxt);
        concatContent.appendChild(sureBtn);
        return concatContent;
    }
}

export default Concat;